package com.burgeon.backend.EnterpriseWeChat.controller;

import com.burgeon.backend.EnterpriseWeChat.entity.ShareTaskData;
import com.burgeon.backend.EnterpriseWeChat.entity.ShareTaskGoods;
import com.burgeon.backend.EnterpriseWeChat.service.EWSHareTaskService;
import com.burgeon.backend.SHOPBACKEND.controller.BaseController;
import com.burgeon.backend.stsutil.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("ewapp/share")
public class EWShareTaskController extends BaseController {

    @Autowired
    private EWSHareTaskService ewsHareTaskService;

    /**
     * 导购分享
     * @param empId
     * @param gid
     * @param token
     * @return
     */
    @RequestMapping("addShareTask")
    public ResponseResult<Integer> addShareTask(String empId, String gid, String token, String storeId,
                                                String empName, String storeName){
        Integer data = ewsHareTaskService.insertShareTask(empId, gid, token,storeId,empName,storeName);
        return new ResponseResult<>(SUCCESS,data);
    }

    /**
     * 获取导购分享的数据
     * @param empId
     * @param token
     * @return
     */
    @RequestMapping("getEmpRate")
    public ResponseResult<ShareTaskData> getEmpRate(String empId, String token, String shareDate){
        ShareTaskData data = ewsHareTaskService.getEmpRate(empId,token,shareDate);
        return new ResponseResult<>(SUCCESS,data);
    }

    /**
     * 获取导购分享的列表
     * @param empId
     * @param token
     * @return
     */
    @RequestMapping("getShareTaskList")
    public ResponseResult<List<ShareTaskGoods>> getShareTaskList(String empId, String token, String shareDate){
        List<ShareTaskGoods> data = ewsHareTaskService.getShareTaskList(empId, token,shareDate);
        return new ResponseResult<>(SUCCESS,data);
    }


}
